package logic.table;

import logic.constants.DefaultConsts;
import android.provider.BaseColumns;
import android.util.Log;

/**
 * 购物车表
 * @author 刘宾  
 * @date 2015年4月7日 下午8:09:24
 */
public class ShoppingCartTable
{
	public static final String table         = "lq_shopping_cart";
	
	public final class ShoppingCartColumns
	        implements
	        BaseColumns
	{
		public final static String COLUMN_ID        = "id";
		public final static String ACCOUNT          = "account";
		public final static String GOODS_ID         = "goodsId";
		public final static String GOODS_TYPE       = "goodsType";
		public final static String EP_ID            = "epId";
		public final static String TITLE            = "title";
		public final static String SELL_POINT       = "sellPoint";
		public final static String INTRO            = "intro";
		public final static String PIC_URL          = "picUrl";
		public final static String COUNT            = "count";
		public final static String SALE_PRICE       = "salePrice";
		public final static String ISDELETE         = "isDelete";
		public final static String SKU_ID           = "skuId";
		public final static String SKU_PROP_DETAIL  = "skuPropDetail";
		public final static String CREATETIME       = "createtime";
		public final static String GOODS_DETAIL_URL = "goodsDetailUrl";
		public final static String BASE_URL 		= "baseUrl";
		public final static String ACTIVITY_ID 		= "activityId";
		public final static String FREE_MONEY 		= "freeMoney";
		
		public final static String ORDERS_STATUS 	= "ordersStatus";
		public final static String ERROR_CODE 		= "errorCode";
		public final static String ERROR_MSG 		= "errorMsg";
	}
	
	public static String getCreateTableSQL() {
		StringBuilder sb = new StringBuilder();
		sb.append("CREATE TABLE IF NOT EXISTS " + table + "(");
		sb.append(ShoppingCartColumns.COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT,");
		sb.append(ShoppingCartColumns.ACCOUNT + " TEXT, ");
		sb.append(ShoppingCartColumns.GOODS_ID + " INTEGER,");
		sb.append(ShoppingCartColumns.GOODS_TYPE + " INTEGER,");
		sb.append(ShoppingCartColumns.EP_ID + " INTEGER,");
		sb.append(ShoppingCartColumns.TITLE + " TEXT,");
		sb.append(ShoppingCartColumns.SELL_POINT + " TEXT,");
		sb.append(ShoppingCartColumns.INTRO + " TEXT,");
		sb.append(ShoppingCartColumns.PIC_URL + " TEXT,");
		sb.append(ShoppingCartColumns.COUNT + " INTEGER,");
		sb.append(ShoppingCartColumns.SALE_PRICE + " INTEGER,");
		sb.append(ShoppingCartColumns.ISDELETE + " TEXT,");
		sb.append(ShoppingCartColumns.SKU_ID + " INTEGER,");
		sb.append(ShoppingCartColumns.SKU_PROP_DETAIL + " TEXT,");
		sb.append(ShoppingCartColumns.CREATETIME + " INTEGER,");
		sb.append(ShoppingCartColumns.GOODS_DETAIL_URL + " TEXT,");
		sb.append(ShoppingCartColumns.BASE_URL + " TEXT,");
		sb.append(ShoppingCartColumns.ACTIVITY_ID + " INTEGER,");
		sb.append(ShoppingCartColumns.FREE_MONEY + " INTEGER,");
		
		sb.append(ShoppingCartColumns.ORDERS_STATUS + " INTEGER DEFAULT 0 ,");
		sb.append(ShoppingCartColumns.ERROR_CODE + " TEXT,");
		sb.append(ShoppingCartColumns.ERROR_MSG + " TEXT");
		sb.append(");");
		Log.d(DefaultConsts.TAG, table + ":" + sb.toString());
		return sb.toString();
	}
}
